package com.多态.练习;
//我们引用的对象不同，调用同一个重写方法，表现的行为不一样
class Draw{
    void fun1(){
        System.out.println("画图");
    }
    static void fun2(Draw draw){
        draw.fun1();
    }
}
class Cycle extends Draw {
    @Override
    void fun1() {
        System.out.println("⚪");
    }
}
class Flower extends Draw{
    @Override
    void fun1() {
        System.out.println("❀");
    }
}
public class Text_1 {
    static void print1(){
        Flower flower = new Flower();
        Cycle cycle = new Cycle();
        //向上转型
        Draw[] draw ={cycle,flower,flower,cycle};
        for(Draw draw1: draw){
            draw1.fun1();
        }
    }


    public static void main(String[] args) {
//        Flower flower = new Flower();
//        Cycle cycle = new Cycle();
//        //向上转型的使用
//        Draw.fun2(cycle);
//        Draw.fun2(flower);

        print1();
    }
}
